package com.easemob.chatui.utils;

import android.content.Context;
import android.widget.ImageView;
import com.lyw.GeoLocationClient.App;
import com.lyw.GeoLocationClient.R;

import com.easemob.chatui.domain.User;
import com.squareup.picasso.Picasso;

public class UserUtils {
    public static User getUserInfo(String username){
        return App.getInstance().getContactList().get(username);
    }
    
    /**
     * 设置用户头像
     * @param username
     */
    public static void setUserAvatar(Context context, String username, ImageView imageView){
        User user = getUserInfo(username);
        if(user != null){
            Picasso.with(context).load(user.getAvatar()).placeholder(R.drawable.default_avatar).into(imageView);
        }else{
            Picasso.with(context).load(R.drawable.default_avatar).into(imageView);
        }
    }
    
}
